package com.itheima.define;

/**
 * 数据类型[] 变量名 = new 数据类型[]{元素1,元素2,元素3};
 * 数据类型[] 变量名 = {元素1,元素2,元素3};
 */
public class ArrayDemo {
    public static void main(String[] args) {
        int a = 10;
        System.out.println(a);

        int[] arr = {11, 22, 33};
        System.out.println(arr);
        System.out.println(arr[1]);

        arr[0] = 44;
        arr[1] = 55;
        arr[2] = 66;

        System.out.println(arr[0]);
        System.out.println(arr[1]);
        System.out.println(arr[2]);

        //以下两种写法是等价的。但是建议大家用第一种，因为这种写法更加普遍
        int[] ages = {12, 24, 36};
        //int ages[] = {12, 24, 36};
    }
}
